<!-- 
  slot  组件扩展 - 常用

  ---

  抽取共性，保留不同

  1. 插槽的基本使用
  2. 插槽的默认值
  3. 如果有多个值，同时放入，一起作为替换元素
-->

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <cpn>
      <!-- 1. 替换没有启名字的插槽 -->
      <!-- <span>标题</span> -->

      <!-- 2. 替换指定name的插槽 -->
      <!-- <span slot='center'>标题</span> -->
      <!-- <button slot="left">返回</button> -->
    </cpn>
  </div>

  <template id='cpn'>
    <div>
     <slot name='left'><span>左边</span></slot>
     <slot name='center'><span>中间</span></slot>
     <slot name='right'><span>右边</span></slot>
    </div>
  </template>

  <script src="../../js/vue.js"></script>
  <script>
    const cpn = {
      template: '#cpn'
    }

    const app = new Vue({
      el: '#app',
      components: {
        cpn
      }
    })
  </script>
</body>
</html>
